package com.fangda.network;

import lombok.Getter;
import lombok.Setter;

/**
 * 网络组件的抽象类
 * @author 赵方方
 */
public abstract class AbstractNetwork implements Network {

	private static final long serialVersionUID = -7358998908932535754L;

	@Getter
    protected String id;

    @Setter
    @Getter
    protected NetworkConfig config;

    @Setter
    @Getter
    protected boolean alive;

    @Setter
    @Getter
    protected NetworkCallback callback;

    public AbstractNetwork(String id, NetworkConfig config) {
        this.id = id;
        this.config = config;
    }

    public String getUrl() {
        return config.getIp() + ":" + config.getPort();
    }
}
